﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Step3_2_1 : CtrlStep
{
    public Dropdown[] dropdowns;
    public int[] inputKeys;
    public int[] tempKeys;

   public override void Init()
    {
        tempKeys = new int[dropdowns.Length];
        for (int i = 0; i < dropdowns.Length; i++)
        {
            int temp = i;
            dropdowns[temp].onValueChanged.AddListener((int t) => {
                tempKeys[temp] = t;
                Debug.Log(tempKeys[temp]);
                
            });
        }
    }

    public override void UpdateAction()
    {
        base.UpdateAction();
        if (!isOver)
        {
            Check();
        }
    }

   

    private void Check()
    {
        int index = 0;
        for (int i = 0; i < inputKeys.Length; i++)
        {
            if (inputKeys[i] == tempKeys[i])
            {
                index++;
            }
        }

        if (index >= inputKeys.Length)
        {
            isOver = true;
            Debug.Log("本步骤完成，下一步");
        }
    }





}
